package com.zpp.wedding_admin.controller;

import com.zpp.wedding_admin.entity.User;
import com.zpp.wedding_common.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@Api(value = "用户模块")
@RestController
@CrossOrigin
@RequestMapping("/weddingadmin/user/")
public class LoginController {

    @ApiOperation(value = "登陆")
    @PostMapping("login")
    //{"code":20000,"data":{"token":"admin"}}
    public R login(@RequestBody User user){
        System.out.println(user);
        return R.ok().data("token","admin");
    }

    @ApiOperation(value = "用户信息")
    @GetMapping("info")
    //{"code":20000,"data":{"roles":["admin"],"name":"admin","avatar":"https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"}}
    public R info(){
        return R.ok().data("roles","admin")
                .data("name","admin")
                .data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }
}
